package learnjava.concur.chapter123;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class BoilTea {
    public static void main(String[] args) throws Exception{
        Logger logger = LoggerFactory.getLogger("");
        Thread t1 = new Thread(()->{
            logger.info("洗水壶");
            try {
                Thread.sleep(1*1000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            logger.info("烧开水");
            try {
                Thread.sleep(15*1000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            logger.info("开水有了");
        },"t1");

        Thread t2 = new Thread(()->{
            logger.info("洗茶壶，洗茶杯，拿茶叶");
            try {
                Thread.sleep(4*1000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        },"t2");
        t1.start();
        t2.start();
        t1.join();
        t2.join();
        logger.info("万事俱备，开始泡茶");
    }
}
